﻿using Mt.Site.Core.WorkFlows.Process;
using Mt.Site.Core.WorkFlows.Process.Entities;
using Mt.Site.Core.WorkFlows.Process.Impl;
using Mt.Site.Core.WorkFlows.Process.Models;
using System;
using System.Threading.Tasks;

namespace Mt.Site.Core.WorkFlows.Diy
{
    public interface IWorkFlowRollBackDiyService
    {
        /// <summary>
        /// 调整待修改的数据 (只能调整撤回的数据，不能调整管理员退回那边的数据，因为前者被修改的数据很少，后者递归嵌套根本找不到哪些被改)
        ///   比如会办撤回时想调整会办领导与会办数据间的关系，如果在所有要修改的数据找齐后调整，就理不清哪些数据要从待删除中恢复，
        ///    如果在前面就调整，则连哪些数据要被修改都还不知道
        /// </summary>
        /// <param name="rollBackData"></param>
        Task CheckRollBackDataBeforeWithdrawAsync(WorkFlowProcessDto taskModel, WorkFlowRollBackData rollBackData, IWorkFlowRollBackService workFlowRollBackService);

        /// <summary>
        /// 撤回操作是否可以执行的补充判断
        /// </summary>
        /// <param name="rollBackData"></param>
        /// <returns></returns>
        Task<bool> CheckStateForWithdrawAsync(WorkFlowRollBackData rollBackData, WorkFlowProcessDto taskModel, bool forced);

        Task ChangeDbDataForGoBackActionAsync(Guid taskId, WorkFlowRollBackData rollBackData, WorkFlowPaper paper, IWorkFlowRollBackService workFlowRollBackService);


        void CheckBackToStep(WorkFlowRollBackData rollBackData, WorkFlowProcessDto taskModel);
    }
}
